package ip;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import net.sunniwell.tools.system.IpUtil;
import net.sunniwell.tools.system.MacUtil;
import org.junit.Test;

public class IpTest {
	public static void main(String[] args) {
		String ip = "172.16.7.219";
		System.out.println(IpUtil.iptolong(ip));
		String mac = "00:07:63:34:34:27";
		System.out.println(MacUtil.macToLong(mac));
		System.out.println("------------------");
		System.out.println(IpUtil.iptolong("172.200.236.248")-IpUtil.iptolong("172.16.1.1"));
		
		List<String> list = new ArrayList<String>();
		list.add("11:11:11:11:11:11");
		list.add("122.343");
		list.add("11:22:33:44:55:66");
		list.add("77:44:11:22:33:66");
		
		for(int i=list.size()-1;i>=0;i--){
			if(!MacUtil.isMac(list.get(i))){
				list.remove(list.get(i));
			}
		}
		for(String line : list){
			System.out.println("=============="+line);
		}
	}

	@Test
	public void test01() throws UnknownHostException {
		System.out.println(InetAddress.getByName("127.0.0.1"));
	}

}
